﻿using System.Web.Mvc;
using ThunderJob.Domain.Validation;

namespace ThunderJob.Controllers.Extensions
{
    public static class ViewResultExtensions
    {
        public static ViewResult Errors(this ViewResult result, ValidationException exception)
        {
            result.ViewData.ModelState.AddModelError(exception.ErrorValidacion.NombrePropiedad, exception.ErrorValidacion.MensajeError);

            return result;
        }
    }
}